<?php
/**
 * Created by PhpStorm.
 * User: Aliaksei Lazerka
 * Date: 9/27/14
 * Time: 2:44 PM
 */

namespace files;

if (!defined('NYMPH_ROOT')) {
    define('NYMPH_ROOT', dirname("../../../" . __FILE__));
    require(NYMPH_ROOT . '/local/loader/kernel/classes/URLClassLoader.php');
}

/**
 * The IFileUtils class provides the main functional
 * for manipulating files and paths
 */
interface IFileUtils
{

    /**
     * (PHP 5)<br/>
     * Change path slashes to system dependent
     * @param string $path
     * @return string string with changed slashes
     */
    static function convertToSystemDependentPath($path);

    /**
     * (PHP 5)<br/>
     * Get relative path. Finds first $rel param
     * @param string $path
     * @param string $rel
     * @param boolean $convert [optional] convert path to system dependent
     * @return string relative path
     */
    static function getRelativePath($path, $rel, $convert);

    /**
     * (PHP 5)<br/>
     * Get relative path. Finds last $rel param
     * @param string $path
     * @param string $rel
     * @param boolean $convert [optional] convert path to system dependent
     * @return string relative path
     */
    static function getRelativePathFromRight($path, $rel, $convert);

    /**
     * (PHP 5)<br/>
     * Get file extension
     * @param string $file
     * @return string relative path or false if file has no extension
     */
    static function getFileExtension($file);

    /**
     * (PHP 5)<br/>
     * Writing to file
     * @param string $file
     * @param string $subject
     * @param string $overwrite [optional] default = false
     * @return boolean
     */
    static function writeToFile($file, $subject, $overwrite);

    /**
     * (PHP 5)<br/>
     * Writing to the end of file file. If cannot write returns false.
     * @param string $file
     * @param string $subject
     * @return boolean
     */
    static function appendFile($file, $subject);

    /**
     * (PHP 5)<br/>
     * Checking file existence. If file does not exist creating file with
     * directory (if it was wrote).
     * @param string $file
     * @return boolean
     */
    static function checkAndCreateFile($file);

    /**
     * (PHP 5)<br/>
     * Returns path to file< without this file name.
     * Can be used to creating paretn dirs for the specified file
     * @param string $path
     * @return string path
     */
    static function getDirs($path);

    /**
     * (PHP 5)<br/>
     * Returns array with all files from directory from $dirForScan.
     * @param string $directory
     * @return array
     */
    static function getAllFilesFromDir($directory);

    /**
     * (PHP 5)<br/>
     * Return path of file.
     * @param string $pathToFile
     * @return string
     */
    static function getFilePath($pathToFile);
}